{% extends 'base.html.twig' %}

{% import "admin/macro.html.twig" as macro %}

{% do css(['libs/vendor.css', 'app/css/admin/main.css'], 100) %}
{% do script(['libs/vendor.js', 'app/js/admin/common.js', 'app/js/admin/main.js'], 100) %}
{% set body_class = 'hold-transition skin-blue-light sidebar-mini' %}

{% block body %}
  <header class="main-header">
    <!-- Logo -->
    <a href="" class="logo">
      <span class="logo-mini"><b>Biz</b></span>
      <span class="logo-lg"><b>Biz</b>Admin</span>
    </a>
    <nav class="navbar navbar-static-top">
      <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
        <span class="sr-only">伸缩导航</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>

      <div class="navbar-custom-menu">
        <ul class="nav navbar-nav">
          <li><a href="#"><span class="hidden-xs">系统管理员</span></a></li>
          <li><a href="#"><span class="hidden-xs">退出</span></a></li>
        </ul>
      </div>
    </nav>
  </header>

  <aside class="main-sidebar">
    <!-- sidebar: style can be found in sidebar.less -->
    <section class="sidebar">
      <!-- sidebar menu: : style can be found in sidebar.less -->
      <ul class="sidebar-menu">
        <li class="header">主导航</li>
        <li class="treeview {{ nav == 'dashboard' ? 'active' : '' }}">
          <a href="{{ path('admin_dashboard') }}">
            <i class="fa fa-dashboard"></i>
            <span>控制台</span>
          </a>
        </li>
        {% set menus = {
          'example': { name: 'Menu 1', path: path('admin_dashboard') },
        } %}
        {{ _self.menu_group('Menu Heading', menus, nav) }}
      </ul>
    </section>
    <!-- /.sidebar -->
  </aside>

  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      {% block content_header %}{% endblock %}
    </section>

    <!-- Main content -->
    <section class="content">
      {% block content_body %}
        <div class="box">
          <div class="box-body">
            {% block content_body_boxed %}{% endblock %}
          </div>
        </div>
      {% endblock %}
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
{% endblock %}

{% macro menu_group(title, menus, nav) %}
  <li class="treeview {{ nav in menus|keys ? 'active' : '' }}">
    <a>
      <i class="fa fa-cube"></i>
      <span>{{ title }}</span>
      <span class="pull-right-container">
        <i class="fa fa-angle-left pull-right"></i>
      </span>
    </a>
    <ul class="treeview-menu">
      {% for key in menus|keys %}
        <li class="{{ nav == key ? 'active' : '' }}">
          <a href="{{ menus[key].path }}">
            <i class="fa fa-circle-o"></i>{{ menus[key].name }}
          </a>
        </li>
      {% endfor %}
    </ul>
  </li>
{% endmacro %}